package org.example.service;

import org.example.mapper.BorrowRecordMapper;
import org.example.model.BorrowRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BorrowRecordService {
    @Autowired
    private BorrowRecordMapper borrowRecordMapper;

    public List<BorrowRecord> query() {
        return borrowRecordMapper.selectRecords();
    }

    public int add(BorrowRecord borrowRecord) {
        return borrowRecordMapper.insertSelective(borrowRecord);
    }

    public BorrowRecord queryById(Integer id) {
        return borrowRecordMapper.selectByPrimaryKey(id);
    }

    public int update(BorrowRecord borrowRecord) {
        return borrowRecordMapper.updateByPrimaryKeySelective(borrowRecord);
    }

    public int delete(List<Integer> ids) {
        return borrowRecordMapper.deleteByIds(ids);
    }
}
